class Car(object):
    def __init__(self, brand, model, color):
        self.brand = brand
        self.model = model
        self.color = color

    def run(self):
        print('i can run')

class GasolineCar(Car):
    def run(self):
        print('i can run with gasoline')

class EletricCar(Car):
    def __init__(self, brand, model, color, battery):
        super().__init__(brand, model, color)
        self.battery = battery

    def run(self):
        print(f'i can run with eletric, i have a {self.battery} kWh battery')

bmw = GasolineCar('宝马', 'X5', '蓝色')
print(bmw.brand)
print(bmw.model)
print(bmw.color)

bmw.run()

tesla = EletricCar('Tesla', 'Model S', '黑色', 82)
print(tesla.brand)
print(tesla.model)
print(tesla.color)

tesla.run()